<template>
  <button 
    class="theme-button"
    :class="[type, size, { 'full-width': fullWidth }]"
    @click="$emit('click')"
  >
    <slot></slot>
  </button>
</template>

<script setup>
defineProps({
  type: {
    type: String,
    default: 'primary', // 'primary' | 'secondary'
    validator: (val) => ['primary', 'secondary'].includes(val)
  },
  size: {
    type: String,
    default: 'medium', // 'small' | 'medium' | 'large'
    validator: (val) => ['small', 'medium', 'large'].includes(val)
  },
  fullWidth: {
    type: Boolean,
    default: false
  }
})

defineEmits(['click'])
</script>

<style scoped>
.theme-button {
  border: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 类型样式 */
.primary {
  background-color: var(--primary-color);
  color: var(--text-primary);
}

.primary:active {
  background-color: var(--primary-active);
}

.secondary {
  background-color: var(--secondary-color);
  color: white;
}

.secondary:active {
  background-color: var(--secondary-active);
}

/* 尺寸样式 */
.small {
  padding: 6px 12px;
  font-size: 12px;
}

.medium {
  padding: 8px 16px;
  font-size: 14px;
}

.large {
  padding: 12px 24px;
  font-size: 16px;
}

/* 全宽样式 */
.full-width {
  width: 100%;
  display: flex;
}

/* 点击涟漪效果 */
.theme-button::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 1%, transparent 1%) center/15000%;
  opacity: 0;
  transition: opacity 0.5s, background-size 0.5s;
}

.theme-button:active::after {
  background-size: 100%;
  opacity: 1;
  transition: background-size 0s;
}
</style>